Skip to content

Conversation

zaach
Copy link

@zaach zaach commented May 16, 2023

This is the minimal addition needed to build js-libp2p with vite. It fixes this error:

relay:build: > vite build
relay:build:
relay:build: vite v4.3.5 building for production...
relay:build: transforming...
relay:build: Use of eval in "../../node_modules/.pnpm/@[email protected]/node_modules/@
protobufjs/inquire/index.js" is strongly discouraged as it poses security risks and may cause
issues with minification.
relay:build: ✓ 604 modules transformed.
relay:build: ✓ built in 3.43s
relay:build: "setMaxListeners" is not exported by "../../node_modules/.pnpm/rollup-plugin-node
[email protected]/node_modules/rollup-plugin-node-polyfills/polyfills/events.js", imported by "
../../node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-manager/utils.j
s".
relay:build: file: /Users/zach/repos/decentralized/ipdm/node_modules/.pnpm/[email protected]/node_
modules/libp2p/dist/src/connection-manager/utils.js:4:9
relay:build: 2: import { logger } from '@libp2p/logger';
relay:build: 3: import { anySignal } from 'any-signal';
relay:build: 4: import { setMaxListeners } from 'events';
relay:build:             ^
relay:build: 5: const log = logger('libp2p:connection-manager:utils');
relay:build: 6: /**
relay:build: error during build:
relay:build: RollupError: "setMaxListeners" is not exported by "../../node_modules/.pnpm/rollu
[email protected]/node_modules/rollup-plugin-node-polyfills/polyfills/events.js",
imported by "../../node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-ma
nager/utils.js".
...

I've published this fix to npm as @zaach/rollup-plugin-node-polyfills for now to get this demo working: https://github.com/zaach/js-libp2p-webrtc-private-to-private

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant